package com.gec.zhs.controller;

import java.util.List;

import com.gec.zhs.entity.query.UploadfileQuery;
import com.gec.zhs.entity.po.Uploadfile;
import com.gec.zhs.entity.vo.ResponseVO;
import com.gec.zhs.service.UploadfileService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 文件 Controller
 */
@RestController("uploadfileController")
@RequestMapping("/uploadfile")
public class UploadfileController extends ABaseController{

	@Resource
	private UploadfileService uploadfileService;
	/**
	 * 根据条件分页查询
	 */
	@RequestMapping("/loadDataList")
	public ResponseVO loadDataList(UploadfileQuery query){
		return getSuccessResponseVO(uploadfileService.findListByPage(query));
	}

	/**
	 * 新增
	 */
	@RequestMapping("/add")
	public ResponseVO add(Uploadfile bean) {
		uploadfileService.add(bean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增
	 */
	@RequestMapping("/addBatch")
	public ResponseVO addBatch(@RequestBody List<Uploadfile> listBean) {
		uploadfileService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增/修改
	 */
	@RequestMapping("/addOrUpdateBatch")
	public ResponseVO addOrUpdateBatch(@RequestBody List<Uploadfile> listBean) {
		uploadfileService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据Id查询对象
	 */
	@RequestMapping("/getUploadfileById")
	public ResponseVO getUploadfileById(String id) {
		return getSuccessResponseVO(uploadfileService.getUploadfileById(id));
	}

	/**
	 * 根据Id修改对象
	 */
	@RequestMapping("/updateUploadfileById")
	public ResponseVO updateUploadfileById(Uploadfile bean,String id) {
		uploadfileService.updateUploadfileById(bean,id);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据Id删除
	 */
	@RequestMapping("/deleteUploadfileById")
	public ResponseVO deleteUploadfileById(String id) {
		uploadfileService.deleteUploadfileById(id);
		return getSuccessResponseVO(null);
	}
}